//
//  HEDoctorPrvaterInfoCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/11/17.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEDoctorPrvaterInfoCell.h"

@interface HEDoctorPrvaterInfoCell ()

@property (nonatomic, strong) UILabel *titleLb;
@property (nonatomic, strong) UILabel *priceLb;
@property (nonatomic, strong) UIView *warp;

@end

@implementation HEDoctorPrvaterInfoCell

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self initUI];
    }
    return self;
}

- (void)initUI {
    
    UIView *warp2 = [UIView new];
    [self.contentView addSubview:warp2];
    warp2.layer.shadowColor = [UIColor colorWithRed:13/255.0 green:98/255.0 blue:218/255.0 alpha:0.08].CGColor;
    warp2.layer.shadowOffset = CGSizeMake(0,5);
    warp2.layer.shadowOpacity = 1;
    warp2.layer.shadowRadius = 6;

    [warp2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView);
        make.left.equalTo(self.contentView);
        make.right.equalTo(self.contentView);
        make.bottom.equalTo(self.contentView);
    }];
    
    UIView *warp = [UIView new];
    _warp = warp;
    warp.backgroundColor = KWhiteColor;
    [warp2 addSubview:warp];
    warp.layer.masksToBounds = YES;
    warp.layer.cornerRadius = 6;
    
    [warp mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(warp2).mas_offset(0);
        make.left.equalTo(warp2).mas_offset(0);
        make.right.equalTo(warp2).mas_offset(-0);
        make.bottom.equalTo(warp2).mas_offset(-0);
    }];

    _titleLb = [UILabel new];
    _titleLb.text = @"-";
    _titleLb.font = DYBlodFont(15);
    _titleLb.textColor = CNavLightBlackColor;
    _titleLb.textAlignment = NSTextAlignmentCenter;
    [warp addSubview:_titleLb];
    
    [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(warp).mas_offset(10);
        make.left.equalTo(warp).mas_offset(0);
        make.right.equalTo(warp).mas_offset(-0);
    }];
    
    _priceLb = [UILabel new];
    _priceLb.text = @"￥30.0/次";
    _priceLb.font = DYBlodFont(15);
    _priceLb.textColor = CPriceColor;
    _priceLb.textAlignment = NSTextAlignmentCenter;
    [warp addSubview:_priceLb];
    
    [_priceLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_titleLb.mas_bottom).mas_offset(10);
        make.left.equalTo(warp);
        make.right.equalTo(warp);
        make.bottom.equalTo(warp.mas_bottom).mas_offset(-10);
    }];
}

- (void)setModel:(HEDoctorInfoModel *)model {
    _model = model;
    
    _titleLb.text = [NSString stringWithFormat:@"%@%@", model.attr_name, model.unit];
    
    _priceLb.text = [NSString stringWithFormat:@"￥%@", [NSDecimalNumber rounding:model.price afterPoint:2]];
    
    if (model.isChoose) {
        _warp.backgroundColor = KHexColor(@"E8F2FE");
        _warp.qmui_borderPosition = QMUIViewBorderPositionBottom | QMUIViewBorderPositionTop| QMUIViewBorderPositionLeft | QMUIViewBorderPositionRight;
        _warp.qmui_borderWidth = 1;
        _warp.qmui_borderColor = CNavBgColor;
    }else {
        _warp.backgroundColor = KWhiteColor;
        _warp.qmui_borderWidth = 0;
    }
}

@end
